<%@ page contentType="text/html; charset=UTF-8" %>
<jsp:include page="/WEB-INF/jsp/common/init.jsp" />
<!DOCTYPE html>
<HTML>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title></title>
 <link rel="stylesheet" href="${path}/style_lib/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css"></link>
 <script type="text/javascript" src="${path}/style_lib/zTree_v3/js/jquery-1.4.4.min.js"></script>
 <script type="text/javascript" src="${path}/style_lib/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
 <script type="text/javascript" src="${path}/style/js/task.js"></script>
 <script type="text/javascript">
 	function zTreeOnClick(event, treeId, treeNode) {
	    var url = treeNode.url_new;
	    if(url!=undefined && $.trim(url).length>0){
	    	window.parent.workiframe.location.replace("${path}"+url);
	    }else{
	    	zTreeObj.expandNode(treeNode);
	    }
	};
 	var setting = {
 			edit: {enable: false},
 			view: {fontCss : {"margin": "2px"}},
			data: {
				simpleData: {
					enable: true,
					idKey:'code',
					pIdKey:'up_code',
					rootPId:'root'
				}
			},
			callback: {
				onClick: zTreeOnClick
			}
		};
	var zNodes = $.parseJSON('${menuJson}');
	var zTreeObj;
	$(function(){
		$.each(zNodes,function(i,n){
			zNodes[i].iconOpen="${path}/style_lib/zTree_v3/icon/open.jpg";
			zNodes[i].iconClose="${path}/style_lib/zTree_v3/icon/close.jpg";
			zNodes[i].icon="${path}/style_lib/zTree_v3/icon/open.jpg";
			
			zNodes[i].url_new=zNodes[i].url;
			zNodes[i].url="";
		});
		
		zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, zNodes);
		zTreeObj.expandAll();
		
		//加载消息
		myLoadTask();
		setInterval('myLoadTask()',300*1000);
	});
	
	function myLoadTask(){
		loadTask("${path}/ix/task/msg.htm");
	}
	
	
	
	</script>
</head>
<body>
	<div class="zTreeDemoBackground left" style="">
		<ul id="treeDemo" class="ztree"></ul>
	</div>
</body>
</html>